export type ResType<T = string> = {
  message?: string;
  data?: T;
  code: number;
};

// 用户信息类型
export interface UserInfo {
  _id: string;
  nickname: string;
  email: string;
  password: string;
  articles: [];
  drafts: [];
  likesList: [];
  avatar: string;
  description: string;
  fans: [];
  followers: string[];
  collectList: CollectionFolder[]; // 用户收藏夹列表
  create_time: string;
  __v: number;
}

// 文章列表项简要信息
export interface Article {
  _id: string;
  title: string;
  authorNickName: string;
  authorEmail: string;
  likes: number;
  views: number;
  summary: string;
  comments: number;
}

// 文章评论的回复列表项类型
export interface ReplyList {
  _id: string;
  authorNickName: string;
  authorEmail: string;
  authorAvatar: string;
  createTime: string;
  content: string;
}

// 文章评论列表项类型
export interface CommentList {
  _id: string;
  authorNickName: string;
  authorEmail: string;
  authorAvatar: string;
  content: string;
  createTime: string;
  replyList: ReplyList[];
}

// 文章详情类型
export interface ArticleDetail {
  _id: string;
  title: string;
  summary: string;
  authorNickName: string;
  authorEmail: string;
  content: string;
  likes: number;
  views: number;
  createTime: string;
  commentList: CommentList[];
  __v: 0;
}

// 草稿详情类型
export interface DraftDetail {
  _id: string;
  title: string;
  summary: string;
  authorNickName: string;
  authorEmail: string;
  content: string;
  createdTime: string;
  __v: number;
}

// 用户上传文章图片类型
export interface UploadImageRes {
  url: string;
  alt: string;
  href: string;
}

// 创建草稿返回结果类型
export interface CreateDraftRes {
  draftId: string;
}

// 保存草稿类型
export interface SaveDraftRes {
  draftId: string;
}

// 用户登录结果返回类型
export type LoginResType = {
  shortToken: string;
  loginToken: string;
};

// 作者草稿类型
export interface AuthorDraft {
  _id: string;
  title: string;
  summary: string;
  authorNickName: string;
  authorEmail: string;
  content: string;
  createdTime: string;
  __v: number;
}

// 收藏夹类型
export interface CollectionFolder {
  folderName: string;
  collectItem: CollectItem[];
  _id: string;
}

// 收藏夹文章项类型
export interface CollectItem {
  title: string;
  _id: string;
  summary: string;
}

// 作者类型
export interface AuthorInfo<T> {
  nickname: string;
  email: string;
  avatar: string;
  description: string;
  create_time: string;
  fans: 0;
  fansList: string[];
  followers: 0;
  articleList: T[];
}

// 用户上传头像返回结果类型
export interface UploadAvatarResType {
  avatar: string;
}
